#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import datetime
from ._base import db


class Site(db.Model):
    """站点信息"""
    id = db.Column(db.Integer, primary_key=True)
    url = db.Column(db.String(100))
    name = db.Column(db.String(100))
    sitelogo = db.Column(db.String(100))
    title = db.Column(db.String(100))
    desc = db.Column(db.Text)

    def __repr__(self):
        return '<Site %s>' % self.url


class Alipay(db.Model):
    """alipay"""
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(100))
    pid = db.Column(db.String(100))
    key = db.Column(db.String(100))

    def __repr__(self):
        return '<Alipay %s>' % self.pid


class MsgRecord(db.Model):
    """record"""
    id = db.Column(db.Integer, primary_key=True)
    type = db.Column(db.String(20))
    ip = db.Column(db.String(100))
    time = db.Column(db.DateTime, default=datetime.datetime.now)

    def __repr__(self):
        return '<MsgRecord %s>' % self.pid
